<template>
  <div class="order_ring">
    <div class="a">
      <div class="b1">
        <div class="ring_bg">
          <span>{{percent_num}}</span>
          <i>%</i>
<!--          <i-circle :percent="percent_num" :size="74" trail-color="transparent" stroke-color="#00a47e" :stroke-width="10" :trail-width="10">-->
<!--            <span class="demo-i-circle-inner" style="font-size:24px">{{percent_num}}%</span>-->
<!--          </i-circle>-->
        </div>
      </div>
      <div class="b2">
        <div class="title">{{title}}</div>
        <div class="num">
          <span>{{order_num}}</span>
          <i>单</i>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "order_ring",  // 订单进度环
    props: {
      title: {
        type: String,
        default: ''
      },
      orderNum: {
        type: Number,
        default: 0
      },
      percent: {
        type: Number,
        default: 0
      }
    },
    data() {
      return {

      }
    },
    computed: {
      percent_num() {
        if(this.percent >= 0 && this.percent <= 100) {
          return this.percent;
        }
      },
      order_num() {
        if(this.orderNum >= 0) {
          if(this.orderNum < 1000) {
            return this.orderNum;
          }else if(this.orderNum >= 1000 && this.orderNum < 1000000) {
            let str = this.orderNum.toString();
            let str1 = str.substring(str.length - 3);
            let str2 = str.substring(str.length - 3, str.length - 6);
            return str2 + ',' + str1;
          }
        }
      }
    },
    created() {

    },
    methods: {}
  }
</script>

<style scoped lang="scss">
  .order_ring {
    min-width: 257px;
    width: 100%;
    height: 100%;
    padding: 20px;
    .a{
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      .b1{
        width: 160px;
        height: 160px;
        background-image: url('../../../assets/screen/ring_bg.png');
        background-size: 100%;
        background-repeat: no-repeat;
        position: relative;
        .ring_bg{
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          display: flex;
          justify-content: center;
          align-items: center;
          height: 30px;
          span{
            font-size: 18px;
            font-weight: bold;
            color: #ddd;
          }
          i{
            font-size: 8px;
            color: #999;
            margin-left: 2px;
          }
        }
        /* .ring_bg{
          background: rgba(255,255,255,0.1);
          border-radius: 50%;
          width: 74px;
          height: 74px;
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          display: flex;
          overflow: hidden;
        } */
      }
      .b2{
        /*min-width: 100px;*/
        .title{
          font-family: Calibri;
          font-size: 20px;
          color: #9a5d16;
          text-align: right;
        }
        .num{
          text-align: right;
          overflow: hidden;
          span{
            font-size: 22px;
            font-weight: bold;
            color: #fff;
            letter-spacing: 1px;
          }
          i{
            margin-left: 6px;
            color: #9a5d16;
          }
        }
      }
    }
  }
</style>
<style lang="scss" scoped>
  /* /deep/ .ivu-chart-circle-inner{
    width: 56px;
    height: 56px;
    text-align: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    line-height: 56px;
    border-radius: 50%;
    background: #000;
    span{
      color: #f37b1d;
      font-weight: bold;
    }
  } */
</style>
